import os
import sys
import time

from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import QWidget, QApplication, QLCDNumber, QSizePolicy, QHBoxLayout


class MyQlcd(QWidget):
    def __init__(self, parent=None):
        super(MyQlcd, self).__init__(parent)
        self.resize(200, 200)
        self.number_lcd = QLCDNumber()
        self.number_lcd.setDigitCount(19)
        self.number_lcd.setSegmentStyle(QLCDNumber.Flat)
        self.number_lcd.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        hl = QHBoxLayout()
        hl.addWidget(self.number_lcd)
        self.setLayout(hl)

        self.timer = QTimer()
        self.init()

    def init(self):
        self.timer.timeout.connect(self.lcd_show)
        self.timer.start(1000)

    def lcd_show(self):
        self.number_lcd.display(time.strftime('%Y-%m-%d %H:%M:%S'))


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = MyQlcd()
    window.show()
    sys.exit(app.exec())
